function formatTimestamp(timestamp) {
  const date = new Date(timestamp * 1000); // 根据时间戳创建 Date 对象

  const year = date.getFullYear(); // 年份
  const month = String(date.getMonth() + 1).padStart(2, "0"); // 月份（注意月份需要补零）
  const day = String(date.getDate()).padStart(2, "0"); // 日期
  const hours = String(date.getHours()).padStart(2, "0"); // 小时
  const minutes = String(date.getMinutes()).padStart(2, "0"); // 分钟
  const seconds = String(date.getSeconds()).padStart(2, "0"); // 秒钟

  const formattedDate = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; // 格式化日期和时间

  return formattedDate;
}


function getCurrentDateTime() {
  const now = new Date();
  const year = now.getFullYear();
  const month = String(now.getMonth() + 1).padStart(2, '0');
  const date = String(now.getDate()).padStart(2, '0');
  const hours = String(now.getHours()).padStart(2, '0');
  const minutes = String(now.getMinutes()).padStart(2, '0');
  const seconds = String(now.getSeconds()).padStart(2, '0');

  return `${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
}

export {
	formatTimestamp,
	getCurrentDateTime
}